#include<iostream>
#include<unistd.h>

void *threadStart(void* args)
{
    while (true)
    {
        std::cout<<"new thread run.."<<std::endl;
        sleep(1);

        int x=rand()%5;
        if(x==0){
            int *p=nullptr;
            *p=100;
        }
    }
    
}

int main(){

    pthread_t tid1;
    pthread_create(&tid1,nullptr,threadStart,(void*)"thread_new");

    pthread_t tid2;
    pthread_create(&tid2,nullptr,threadStart,(void*)"thread_new");

    pthread_t tid3;
    pthread_create(&tid3,nullptr,threadStart,(void*)"thread_new");

    while (true)
    {
        sleep(1);
        std::cout<<"main thread run.."<<std::endl;
        
    }
    return 0;

}